home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / WWIV Mods / WWIVMOD.ZIP / TESTUP13.MOD < prev    next >
Encoding:
Text File  |  1990-09-29  |  10.3 KB  |  337 lines

  1. Captain Learjet #1 @8755
  2. Wed Sep 26 02:38:41 1990
  3.  
  4. /*
  5.  
  6.  
  7.  
  8.                             Test Upload Mod
  9.                             ~~~~~~~~~~~~~~~
  10.                                  v1.3
  11.  
  12.  
  13.                                   by
  14.  
  15.                             Captain Learjet
  16.                                 1 @8755
  17.  
  18.                                Sysop of
  19.                            - = InFlight = -
  20.  
  21.                              817-766-0533
  22.  
  23.  
  24.     Hi! There have been several complaints about the Test Arc, Viruscan,
  25.   Comment Upload and a few other mods having a severe bug that would open
  26.   a bunch of files, and not close them causing the BBS to freak out and
  27.   not find any file anywhere.
  28.  
  29.     Well it turns out that this was happening because of those mods using
  30.   the dliscan() function improperly. Files were being opened twice and closed
  31.   only once resulting in the above problem after a few uploads, depending on
  32.   what the Sysop has his FILES= set at.
  33.  
  34.     The following is new and improved version of three mods combined.
  35.   The Test Arc mod originally written by The Captain, the Viruscan mod
  36.   written by The Caretaker and the Comment Upload mod. I can't remember who
  37.   wrote the Comment mod (SORRY! :) ).
  38.  
  39.     This function will run an archive test and/or scan for viruses on files
  40.   uploaded with the .ARC, .LZH, .PAK, .ZIP .EXE and .COM extensions. It will
  41.   also add an ANSI comment to your .ZIP files. In addition, you can run any
  42.   one of the three sections individually.
  43.  
  44.     Also, ^C (heart) means ^P^C in most editors.
  45.  
  46.  
  47.                              Disclaimer (of course)
  48.  
  49.   If it screws up, it's not my fault. I didn't force you to use it.
  50.   It runs flawlessly on my system.
  51.  
  52.   I ask for a donation of  0 dollars, and 0 cents, cuz it sucks to
  53.   ask for money.
  54.  
  55.                                  How's that?                                 */
  56.  
  57. <<  Step one:  >>   
  58.  
  59.     Load BBS.C and do this in void dlmainmenu() :
  60.  
  61.  
  62.  
  63.   if (strcmp(s,"/O")==0)
  64.     hangup=1;
  65.   if ((strcmp(s,"/?")==0) && (dcs()))      /*   <--  Search for this. */
  66.     printmenu(8);
  67.   if (strcmp(s,"/T")==0)                                  /*  ADD  */
  68.     test_arc();                                           /*  ADD  */
  69.   if (strcmp(s,"/V")==0)                                  /*  ADD  */
  70.     check_for_virus();                                    /*  ADD  */
  71.   if ((strcmp(s,"/K")==0) && (dcs()))                     /*  ADD  */
  72.      add_comment();                                       /*  ADD  */
  73.   if ((strcmp(s,"UPLOADALL")==0) && (dcs())) {       /* original code   */
  74.  
  75.  
  76.     Save BBS.C
  77.  
  78.  
  79. <<  Step two:  >>
  80.  
  81.  
  82.     Load XFER.C and add the following FOUR functions near the top
  83.       of the file:
  84.  
  85.  
  86. void test_upload(int l, int sysop, char *s)
  87. {
  88.   char s1[81],s2[81],s3[81];
  89.   int i,i1,type,abort,next;
  90.   uploadsrec u;
  91.  
  92.   type=abort=next=0;
  93.  
  94.   if (l) {
  95.     align(s);
  96.     dliscan();
  97.   }
  98.   i=recno(s);
  99.   do {
  100.     if (i>0) {
  101.       SETREC(i);
  102.       read(dlf,(void *)&u,sizeof(uploadsrec));
  103.       if (l==0 || l==1) {
  104.         if ((compare(u.filename,"????????.ARC")) ||
  105.             (compare(u.filename,"????????.LZH")) ||
  106.             (compare(u.filename,"????????.PAK")) ||
  107.             (compare(u.filename,"????????.ZIP"))) {
  108.           if (!sysop)
  109.             sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
  110.                     stripfn(u.filename));
  111.           else
  112.             sprintf(s1,"%s%s",directories[0].path,stripfn(u.filename));
  113.           if (exist(s1)) {
  114.             ansic(2);
  115.             print("Testing archive integrity of ",u.filename,":","");
  116.             nl();
  117.             if (strstr(u.filename,".ARC"))
  118.               sprintf(s2,"PKUNPAK -T %s",s1);
  119.             if (strstr(u.filename,".LZH"))
  120.               sprintf(s2,"LHARC T %s",s1);
  121.             if (strstr(u.filename,".PAK"))
  122.               sprintf(s2,"PAK T %s",s1);
  123.             if (strstr(u.filename,".ZIP"))
  124.               sprintf(s2,"PKUNZIP -T %s",s1);
  125.             i1=run_external1(s2);
  126.             prt(2,u.filename);
  127.             if (i1) {
  128.               pl(" 6 \7FAILED\7 2 the archive test!");
  129.               nl();
  130.               sprintf(s2,"2%s 6FAILED 2 an archive test. Please check the file!0",u.filename);
  131.               ssm(1,0,s2);
  132.               sysoplog(s2);
  133.               if (l)
  134.                 closedl();
  135.               return;
  136.             } else {
  137.               prt(5,"5 PASSED 2 the archive test.");nl();
  138.             }
  139.           }
  140.           checka(&abort,&next);
  141.         }
  142.       }
  143.       if (l==0 || l==2) {
  144.         if ((compare(u.filename,"????????.ARC")) ||
  145.             (compare(u.filename,"????????.LZH")) ||
  146.             (compare(u.filename,"????????.PAK")) ||
  147.             (compare(u.filename,"????????.ZIP")))
  148.           type=1;
  149.         if ((compare(u.filename,"????????.EXE")) ||
  150.             (compare(u.filename,"????????.COM")))
  151.           type=2;
  152.         if (type) {
  153.           if (!sysop)
  154.             sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
  155.                     stripfn(u.filename));
  156.           else
  157.             sprintf(s1,"%s%s",directories[0].path,stripfn(u.filename));
  158.           if (exist(s1)) {
  159.             nl();
  160.             ansic(2);
  161.             print("Scanning ",u.filename," for viruses:","");
  162.             nl();
  163.             prt(3,"Please be patient...");nl();
  164.             if (type==1) {
  165.               if (strstr(u.filename,".ARC"))
  166.                 sprintf(s2,"PKUNPAK %s %s",s1,syscfg.tempdir);
  167.               if (strstr(u.filename,".LZH"))
  168.                 sprintf(s2,"LHARC X %s %s",s1,syscfg.tempdir);
  169.               if (strstr(u.filename,".PAK"))
  170.                 sprintf(s2,"PAK E %s %s",s1,syscfg.tempdir);
  171.               if (strstr(u.filename,".ZIP"))
  172.                 sprintf(s2,"PKUNZIP %s %s",s1,syscfg.tempdir);
  173.               run_external(s2);
  174.               sprintf(s3,"SCAN /nomem %s*.*",syscfg.tempdir);
  175.               i1=run_external1(s3);
  176.               remove_from_temp("*.*",0);
  177.             } else {
  178.               sprintf(s2,"SCAN /nomem %s",s1),
  179.               i1=run_external1(s2);
  180.             }
  181.             prt(2,u.filename);
  182.             if (i1==1) {
  183.               pl(" 6 \7FAILED\7 2 the virus test! 0");
  184.               nl();
  185.               sprintf(s2,"%s FAILED the virus test. Please delete the file!",
  186.                       u.filename);
  187.               ssm(1,0,s2);
  188.               sysoplog(s2);
  189.               if (l)
  190.                 closedl();
  191.               return;
  192.             } else {
  193.               pl(" 5PASSED 2 the virus test. 0");
  194.               nl();
  195.             }
  196.           }
  197.           checka(&abort,&next);
  198.         }
  199.       }
  200.       if (l==0 || l==3) {
  201.         if (compare(u.filename,"????????.ZIP")) {
  202.           sprintf(s3,"Adding comment to %s",u.filename);
  203.           prt(2,s3);nl();
  204.           if (!sysop)
  205.             sprintf(s1,"PKZIP -z %s%s < %sCOMMENT.TXT",
  206.                     directories[udir[curdir].subnum].path,stripfn(u.filename),
  207.                     syscfg.gfilesdir);
  208.           else
  209.             sprintf(s1,"PKZIP -z %s%s < %sCOMMENT.TXT",
  210.                     directories[0].path,stripfn(u.filename),syscfg.gfilesdir);
  211.           run_external(s1);
  212.         }
  213.         checka(&abort,&next);
  214.       }
  215.     }
  216.     i=nrecno(s,i);
  217.   } while ((i>0) && (!hangup) && (!abort));
  218.   if (l)
  219.     closedl();
  220. }
  221.  
  222. void test_arc()
  223. {
  224.   char s[81];
  225.  
  226.   nl();
  227.   prt(2,"Archive to Test: ");
  228.   mpl(12);
  229.   input(s,12);
  230.   if (strchr(s,'.')==NULL)
  231.     strcat(s,".*");
  232.   test_upload(1,0,s);
  233.   topscreen();
  234. }
  235.  
  236. void check_for_virus()
  237. {
  238.   char s[81];
  239.  
  240.   nl();
  241.   prt(2,"Archive to Scan: ");
  242.   mpl(12);
  243.   input(s,12);
  244.   if (strchr(s,'.')==NULL)
  245.     strcat(s,".*");
  246.   test_upload(2,0,s);
  247.   topscreen();
  248. }
  249.  
  250. void add_comment()
  251. {
  252.   char s[81];
  253.  
  254.   nl();
  255.   prt(2,"Add Comment to: ");
  256.   mpl(12);
  257.   input(s,12);
  258.   if (strchr(s,'.')==NULL)
  259.     strcat(s,".*");
  260.   test_upload(3,0,s);
  261.   topscreen();
  262. }
  263.  
  264. << Step three: >>
  265.  
  266. In the function void upload(int dn) add this stuff:
  267.  
  268.  
  269.           sprintf(s,"+%s uploaded on %s",u.filename,directories[dn].name);
  270.           sysoplog(s);                       /* search for the above line */
  271.           if (!incom) {                      /* ADD */
  272.             nl();                            /* ADD */
  273.             prt(5,"Test the File? ");        /* ADD */
  274.             if (yn())                        /* ADD */
  275.               test_upload(0,0,u.filename);   /* ADD */
  276.           } else {                           /* ADD */
  277.             if (!dn)                         /* ADD */
  278.               test_upload(0,1,u.filename);   /* ADD */
  279.             else                             /* ADD */
  280.               test_upload(0,0,u.filename);   /* ADD */
  281.           }                                  /* ADD */
  282.           nl();
  283.           pl("File uploaded.");              /* Original code continues */
  284.  
  285.  
  286.  
  287.     Save XFER.C
  288.  
  289. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  290.  
  291.  
  292.   Now recompile.
  293.  
  294.  
  295.                                   Notes
  296.  
  297.    New with this release:
  298.  
  299.    Now works when the user uploads with the 'Z' command and also if the
  300.    Sysop has all uploads going to the Sysop directory only.
  301.  
  302.  
  303.                   ***********   READ THIS  ***********
  304.                                     \/
  305.    If you are currently using Test Upload 1.2 or before, you must replace
  306.    all the functions with the new ones.
  307.  
  308.    The new functions are more portable.  You no longer have to hard code
  309.    your temporary directory into the function. You must now have your
  310.    COMMENT.TXT file in your GFILES directory.
  311.  
  312.  
  313.    You must have PKUNPAK, LHarc, PAK, PKZIP and PKUNZIP in your WWIV
  314.    directory. If you don't have all of these get them. Or if you don't
  315.    allow uploads of all types of archives, edit this file accordingly.
  316.  
  317.  
  318.    You also need to get a copy of McAfee's SCAN program, VERSION 62 or HIGHER
  319.    and put it in your WWIV dir.
  320.  
  321.  
  322.  
  323.               If you use this at LEAST email 1 @ 8755 and tell me!
  324.  
  325.  
  326.  
  327.  
  328.    COMING SOON!  Test Upload 2.0 to be run as the WWIV 4.12 Upload Event.
  329.  
  330.  
  331.  
  332.  
  333.                              7Captain Learjet
  334.                                 215@ 78755
  335.                                    aka
  336.                               3Donnie Sigrist